﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sripirom.Pattern.UnitTest.Core.Domain;

namespace Sripirom.Pattern.UnitTest.Model.TestCases
{
    public class UnitTestClass : BaseEntity<String>
    {
        private IList<UnitTestFunction> _functions;
        public UnitTestClass()
        {
            _functions = new List<UnitTestFunction>();
        }
        public UnitTestClass(IList<UnitTestFunction> testFunctions)
        {
            _functions = testFunctions;
        }
        public String Name { get; set; }
        public String Type { get; set; }

        public IEnumerable<UnitTestFunction> TestFunctions { get { return _functions; } }
        public void AddFunction(UnitTestFunction function)
        {
            _functions.Add(function);
        }
        public void RemoveFunction(UnitTestFunction function)
        {
            UnitTestFunction removeFunction = _functions.FirstOrDefault(a => a == function);
            if (removeFunction == null)
                throw new ArgumentOutOfRangeException("Function not found.");

            _functions.Remove(removeFunction);
        }
        protected override void Validate()
        {                                 
            throw new NotImplementedException();
        }
    }
}
